package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.model.Course;
import com.zr.service.CourseService;
import com.zr.service.MarkService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class GetCnameController extends HttpServlet{
	 	CourseService cs=new CourseService();
		@Override
		protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
			// TODO Auto-generated method stub
			doPost(req, resp);
		}
		@Override
		protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
			int tid=Integer.parseInt(req.getParameter("tid"));
			resp.setCharacterEncoding("utf8");
			JSONArray jsa=cs.getAllCourseByTid(tid);
			PrintWriter pw = resp.getWriter();
			pw.write(cs.getAllCourseByTid(tid).toString());
		}
}
